/**   
 * @Title: LoginControl.java 
 * @Package cn.edu.cdtu.healthserver.service 
 * @Description: TODO 
 * @author  
 * @date 
 * @version V0.0   
 */
package cn.edu.cdtu.healthserver.service;

import javax.servlet.http.HttpServletRequest;

import cn.edu.cdtu.healthserver.domain.UserInformation;
import cn.edu.cdtu.healthserver.utils.ConnectUtil;

/** 
 * @ClassName: LoginControl 
 * @Description: TODO
 * @author 
 * @date 
 *  
 */
public class LoginControl {
	
	/**
	 * 
	 * @Title: LoginControl
	 * @Description: 防止生成实例，若需要生成实例请更改
	 * @throws 
	 *
	 */
	private LoginControl(){
		
	}

	/**
	 * 
	 * @Title: getLoginedUser 
	 * @Description: 根据请求返回用户对象实体
	 * @return User
	 * @throws 
	 *
	 * @param request
	 * @return
	 */
	public static UserInformation getLoginedUser(HttpServletRequest request){
		UserInformation user = (UserInformation) request.getSession()
				.getAttribute(ConnectUtil.LoginPargrams.Pargram.lOGIN_USER);
		return user;
	}
	/**
	 * 
	 * @Title: setLoginedUer 
	 * @Description: TODO
	 * @return void
	 * @throws 
	 *
	 * @param request
	 * @param user
	 */
	public static void setLoginedUer(HttpServletRequest request, UserInformation user ){
		request.getSession().setAttribute(
				ConnectUtil.LoginPargrams.Pargram.lOGIN_USER,user);
	}
}
